package fm.mongoService;

import com.mongodb.DBObject;
import fm.dto.NeiyiUser;
import fm.dto.SystemUser;
import fm.entityEnum.CarouselType;


import java.util.List;
import java.util.Map;

/**
 * Created by 61741 on 2018/1/8.
 */
public interface UserService {

    /**
     * 分页获取用户信息
     *
     * @param pageSize
     * @param pageSite
     * @param params
     * @param sort
     * @return
     */
    List<NeiyiUser> getUserPage(Integer pageSize, Integer pageSite, Map params, Map sort);

    /**
     * @param user
     */
    void addUser(NeiyiUser user) throws Exception;

    /**
     * 获取商铺／所有指定类型的用户数
     *
     * @param params   用户注册类型
     * @param pageSize
     * @param pageNum
     * @return
     */
    List<NeiyiUser> getByTypeAndUserId(Map params, Integer pageSize, Integer pageNum,String sort) throws Exception;

    /**
     * 统计
     *
     * @param param
     * @return
     */
    long countUser(Map param) throws Exception;

    /**
     * 批量导入用户信息
     *
     * @param list
     */
    int insertUserbyExcel(List<Map<String, Object>> list, Integer userType);

    /**
     * 根据用户ID 获取用户认证资料
     *
     * @param userId
     * @return
     */
    NeiyiUser getUserAuthInfo(String userId);


    /**
     * 更新用户信息
     *
     * @param queryParam
     * @param updateItem
     * @return
     */
    int updateUserInfo(Map queryParam, Map updateItem);

    int updateUserInfo(Map query, SystemUser user);

    /**
     * 短信验证码登陆
     *
     * @param phone
     * @param smsCode
     * @return
     */
    boolean checkSms(String phone, String smsCode) throws Exception;

    /**
     * @param userName
     * @param password
     * @return
     * @throws Exception
     */
    boolean checkPass(String userName, String password) throws Exception;

    /**
     * @param phone
     * @return
     */
    NeiyiUser getUserByPhone(String phone);

    /**
     * @param phone
     * @return
     */
    NeiyiUser getById(String phone);


    /**
     * @param openid
     * @return
     */
    NeiyiUser getUserByOpenId(String openid);


    /**
     * 根据unionid获取用户
     *
     * @param unionid
     * @return
     */
    NeiyiUser getUserByUnionid(String unionid);

    /**
     * 获取所有的商户信息
     *
     * @return
     */
    List<NeiyiUser> getAllMerchantUser() throws Exception;

    /**
     * @param userType,keyword
     * @return
     */
    List<NeiyiUser> getUserList(Integer userType,String keyword) throws Exception;

    /**
     * @param userType,keyword,pageSize,pageNum
     * @return
     */
    List<NeiyiUser> getUserPageList(Integer userType,String keyword, Integer pageSize, Integer pageNum) throws Exception;

    /**
     * @param type,shopId
     * @return
     */
    List<DBObject> getCarouselListByUserId(CarouselType type,String shopId) throws Exception;

    /**
     *
     * @param name
     * @param phone
     * @throws Exception
     */
    void InserApplayInfo(String name ,String phone) throws Exception;
    void deleteApplayInfo(String phone) throws Exception;

    void deleteUserById(String id) throws Exception;
    void updateApplayInfo(String phone) throws  Exception;
    List<DBObject> getApplayList(Integer pageNum,Integer pageSize) throws Exception;
}
